/*import {reactive, readonly} from "vue";

setup(){
    let info = reactive({
        name: "hah",
        age: 18
    })
    let readonlyInfo = readonly(info)
    //readonly参数
    //1.普通对象  2.reactive返回的对象  3.ref返回的对象
    //readonly方法返回的对象的setter被劫持
    let info2 = { name: "jackie" };
    let readonlyInfo2 = { name: "jackie" };
    return{
        info,
        info2,
        readonlyInfo,
        readonlyInfo2
    }
}*/


let info = {
    name: "hah",
    age: 18
}

let infoProxy = new Proxy(info,{
    get(target,key){
        console.log(target,key);
        return target[key]
    },
    set(target,key,value){
        console.log(target,key,value);
        //target[key] = value;
        console.warn("不允许修改")
    }
})

console.log(infoProxy.name)
infoProxy.name = "哈哈"
console.log(infoProxy.name)